package test4;

import java.util.concurrent.ArrayBlockingQueue;

public class TestQueue {
    public static void main(String[] args) throws InterruptedException {
        ArrayBlockingQueue<String> arrayBlockingQueue = new ArrayBlockingQueue<>(3);
        arrayBlockingQueue.put("a");
        System.out.println(arrayBlockingQueue);
        arrayBlockingQueue.put("b");
        System.out.println(arrayBlockingQueue);
        arrayBlockingQueue.put("c");
        System.out.println(arrayBlockingQueue);
//        arrayBlockingQueue.add("d");
        arrayBlockingQueue.put("d");
        System.out.println(arrayBlockingQueue);
        String s1 = arrayBlockingQueue.take();
        System.out.println(s1);
        String s2 = arrayBlockingQueue.take();
        System.out.println(s2);
        String s3 = arrayBlockingQueue.take();
        System.out.println(s3);
        String s4 = arrayBlockingQueue.take();
        System.out.println(s4);

    }
}
